package nowcoder;
/**
 * -幸运的袋子
 * 链接：https://www.nowcoder.com/practice/a5190a7c3ec045ce9273beebdfe029ee?tpId=85&&tqId=29839&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 */
import java.util.*;
public class Day14_2 {
    private static int count = 0;
    // set 用于存储元素的小标，防止多次添加同一元素
    private static Set<Integer> set = new HashSet<>();
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < arr.length; i ++) {
            arr[i] = input.nextInt();
        }
        Arrays.sort(arr);

        dfs(arr, 0, 0, 0, 0);
        System.out.println(count);
    }

    private static void dfs(int[] arr, int curIndex, int size, int sum, int ji) {
        if(sum > ji) {
            count ++;
        }else if(size > 1) {
            return;
        }

        Set<Integer> inner = new HashSet<>();
        for(int i = curIndex; i < arr.length; i ++) {
            if(!set.contains(i)){
                if(inner.add(arr[i])){
                    set.add(i);
                    int ret = ji == 0 ? arr[i] : arr[i] * ji;
                    dfs(arr, i + 1, size + 1, sum + arr[i], ret);
                    set.remove(i);
                }
            }
        }
    }
}
